import os

def main():
    fr = open("/home/changhengyi/gru-pytorch/test-856.scp2", "r")
    fw = open("/home/changhengyi/gru-pytorch/test-856.scp", "w")

    cnt = 0
    line = fr.readline()
    while line:
        _, feas_path, label_path = line.strip().split()
        if os.path.exists(feas_path) and os.path.exists(label_path):
            fw.write(line)
        else:
            cnt += 1
        line = fr.readline()
    print(cnt)

    fw.close()
    fr.close()


if __name__ == "__main__":
    main()